<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
<script>
// 面向对象思想
// 表现力的JSON 对象字面量
// let 变量 关键字
// key:value,
// typeof(类型)：Object(对象)
let hb = {
    name: '胡巴', //字符串 string
    hometown: '捉妖记',
    age: 3, // 不适合计算 数值类型 number
    sex: '男',
    hobbies: [' 吃','喝'], // 此处的中括号仍为object类型，是一个对象
    isSingle: true,
    job: null,
    sendFlower: function(target){
        target.receiveFlower(hb);
    }
}
let a;
let yh = {
    xq: 30,
    name: '妖后',
    hometown: '妖谷',
    receiveFlower: function(sender){
        // console.log('妖后收到了花',sender.name);
        console.log('妖后收到了'+sender.name+'的花');
        if(this.xq<80){
            console.log('不收');
        }else {
            console.log('收到');
        }
    }
}
let yw = {
    name: '妖王',
    hometown: '妖谷',
        receiveFlower: function(sender){
            setTimeout ( function(){
                yh.xq = 90;
                yh.receiveFlower(sender);
            },3000 )
        // console.log('妖王收到了'+sender.name+'的花');
        // yh.receiveFlower(sender);
        // if(sender.name ==='hb'){
        //     console.log('收到');
        // }
    }
}

</script>
</body>
</html>